import unittest, os, sys

# auto-discover all test_ files in the testdir, and add their suite's to the main suite
if __name__=='__main__':
    this_dir = os.path.dirname(os.path.abspath(__file__))
    suite = unittest.TestSuite()
    for testfile in os.listdir(this_dir):
        if testfile.startswith('test_') and testfile.endswith('.py'):
            testfile = os.path.splitext(testfile)[0]
            module = __import__(testfile)
            suite.addTest(module.suite())
    # run the suites with output to stdout in text format
    # unittest.TextTestRunner(verbosity=2).run(suite) 
    unittest.TextTestRunner(verbosity=2).run(suite) 
